<?php 

/*setcookie('username','lky',time()+3600);*/
/*setcookie('username1',array('username'=>'lky','password'=>'123456'),time()+3600);*/


/*$userinfo=array('username'=>'lky','password'=>'1234560');

$str = json_encode($userinfo);  /*转成字符串*/

/*setcookie('userinfo',$str,time()+3600);*/
//session_start();
/*var_dump($_SESSION);*/
//$_SESSION['username']='lky';





//2017-07-02
//1. request 请求,发送过去的
//2. response 反应; 回答，答复 发送回来的并保留在电脑上
//setcookie(name, value, expire, path, domain); 
$arr = array('name'=>'L','sex'=>'男');

$str = json_encode($arr);  //字符串转json串  'name' => string '{"name":"L","sec":"\u7537"}'
//$arr = json_decode($_COOKIE['name'],true);  //json串转数组  没加true转出来是对象
//
//
//serialize连载，连播(字符串转序列化)
//$str = serialize($arr); //'name' => string 'a:2:{s:4:"name";s:1:"L";s:3:"sec";s:3:"男";}'
//unserialize 序列化反转
setcookie('name',$str,time()+86400);

























 ?>